a) Field of the Invention
The present invention relates to a method for writing/reading of data in a magnetic disk subsystem, and more particularly to a method for writing/reading of data in a magnetic disk subsystem such as a disk cache, semiconductor memory unit or the like, which method is optimum for rapid access to an object record in an IC memory, where the IC memory is the recording medium used in the magnetic disk subsystem. It should be noted that the term "semiconductor memory units" encountered herein refers to memory units of which the data format is the same as in the magnetic disk memory units, and the CPU is composed of an IC group to which direct access can be made as for the magnetic disk units. The semiconductor memory unit is also called a "semiconductor disk unit".
b) Description of the Related Art
The data access method in the conventional magnetic disk subsystem will be explained, taking a disk cache by way of example.
FIG. 1 (a) shows a track format on the magnetic disk, which is formed by the variable-length record system called "count key data (CKD)" system. In FIG. 1 (a), there is shown a track format for one track. As shown, there are formed on the track T1' a home address HA of a fixed length and a plurality of records R1' to Rn'. Each of the records R1' to Rn' is composed of a count area C of a fixed length, a key area K of a variable length and a data area D of a variable length as shown. There are also provided gap areas of a fixed length (not shown) before each of the records Rl' to Rn', between the count area C and key area K, and between the key area K and data area D, respectively. Similarly, gap areas of a fixed length are provided between the index marker IM' and home address HA'.
In the above-mentioned configuration of the track Tl', the count area C is provided for writing therein of the information such as the address of the track, record No., length of the key area K, length of the data area D, etc. The record address is defined by the track address and record No. in the count area C. The key area K is an indicator and it is provided for writing therein of information such as the numbers allocated to the employees of a company, their social insurance Nos., numbers allocated to the customers, etc.
The above-mentioned track format is formed on a magnetic disk as will be described below. That is, as shown in FIG. 1 (c), the record area on the magnetic disk is divided into plural sectors, each of a predetermined angle, and the sectors are assigned sector Nos. S140 to Sn', respectively. The track index marker IM' is provided for each track between the sectors Sn' and Sl'. In FIGS. (a) and (c), the record Rn', for example, is stored in the sector Sm' in the track Tl' (not shown in FIG. 1 (c)).
The magnetic head provided in the magnetic disk unit is brought as follows to an object record on the track. Namely, first the magnetic head is positioned on the object track. Next, the magnetic head detects the address marker (not shown) provided before each of the count areas C and is sequentially positioned to the count areas C of the record. As the magnetic disk rotates, the magnetic head reads the track address and record No. stored in each of the count areas C. Based on the track address and record No. sequentially read by the magnetic head, it is judged whether the record to which the magnetic is currently positioned is the object. When the record to which the magnetic head is currently positioned is judged to be the object data is written into or read from the data area D in the record.
Next, data recording in a disk cache will be explained below. Generally, the IC memory group in the disk cache is divided into units, each of which can accommodate the data for one track on the disk. Each unit is called a track slot. Therefore, one track slot stores the data for one track on the magnetic disk unit. FIG. 1 (b) shows an example in which the data for one track shown in FIG. 1 (a) including the gap area are copied as is into the IC memory group in the disk cache. As shown, the home address HA and records Rl' to Rn' on the magnetic disk are formed as they are in the track slot TS1'. Generally, for writing data into the IC memory group in the disk cache, an error correction code (ECC) of a few bits is added for every set of data of a few bytes.
As is well known, the error correction code (ECC) is used at the time of reading data from the IC memory to check whether the data have been read correctly or not. In FIG. 2, for example, data of 4 bytes D1, D2, D3, . . . are written with 1-byte error correction codes (ECC) E1, E2, E3, . . . added, respectively. At the time of reading, the data D1 and error correction code E1 are read simultaneously, and it is judged whether the combination of the data D1 and error correction code E1 is valid or not. When the combination is judged to be valid, the data D1 are verified as having been read correctly. If the combination is judged to be invalid, it means that an error has occurred in the reading of the data D1. This is also true for the relationship between the data D2 and error correction code E2, for the data D3 and error correction code E3, etc.
Next, the conventional method for access to an object record in an IC memory group in a disk cache will be explained below. The operation for access to the count area (C) 110' within the record Rn' in the track slot TS1' will be explained with reference to FIG. 1 (b).
First, the application of the data read from a magnetic disk unit to the data read from the IC memory group in a disk cache will be explained. As shown in FIG. 1 (b), the count area (C) 110' within the record Rn' in the track slot TS1' belongs to the sector Sm' which exists between the addresses AD11' and AD14' of the track slot TS'. The address AD11' of the sector Sm' can be determined by a well-known method from the total capacity of one track on the magnetic disk and the number of sectors of one track. Therefore, the controller for disk cache permits access to begin at the address AD11' of the track slot TS1'. However, when the track T1' on the magnetic disk shown in FIG. 1 (a) has been copied into the IC memory group as shown in FIG. 1 (b), it is not possible to know whether the data sequentially read from the address AD11' belongs to the gap area, count area C, key area K or data area D. This is because for example, if the data read from the IC memory group in the disk cache is of 4 bytes, 2.sup.32 patterns exist because one byte consists of 8 bits. Therefore, the data read from the IC memory group possibly takes the same pattern as the data in the gap area and the same pattern as that of the address marker.
For the above-mentioned reason, an object record in the track slot TS1' in the disk cache is accessed usually in any of the following two manners.
The first method is as follows. The top address AD4' of the record R1' in the track slot TS1' shown in FIG. 1 (b) is determined by adding, to the top address AD0' of the track slot TS1', the address length of the gap area 101', address length of the home address (HA') 102' and the address length of the gap area 103'. Next, the top address AD10' of the record R2' is determined by adding, to the address AD4', the address length of the count area (C) 104', address length of the key area (K) 106', address length of the data area (D) 108', and the address length of each of the gap areas 105', 107' and 109'. The address length of the key area (K) 106' and that of the data area (D) 108' can be determined by reading the data in the count area (K) 104'. By a similar method, the top address of each record can be determined sequentially. Finally, the top address AD12' of the object record Rn' is determined. Then, by reading the address data in the count area (C) 110', the top address AD14' of the data area (C) 110' in the record Rn' can be determined. Thus, it is possible to read the data in the data area (D) 114' in the record Rn'.
The second method is as follows. As shown in FIG. 3, a table listing the top addresses of all the records existing in each track slot is stored into the memory. For access to an object record, the top address of the object record is read from the above-mentioned memory, and by the access to the address thus read, the object data can be obtained.
However, the above-mentioned first method is disadvantageous in that since the top addresses of the records existing on the track slot are searched sequentially, it takes a long time until an object record is accessed.
The above-mentioned second method is also disadvantageous in that, since it is necessary to store the top addresses of all records existing on each track slot, a memory of a huge capacity is required.
It should be noted that a conventional technique as related to this invention is disclosed in the Japanese Unexamined Patent Publication No. 54-106132.